local kurou = fk.CreateSkill({
  name = "mini_mou__kurou",
})

Fk:loadTranslationTable{
  ["mini_mou__kurou"] = "苦肉",
  [":mini_mou__kurou"] = "出牌阶段开始时，你可以交给一名其他角色一张牌，然后你失去1点体力。" ..
  "当你失去1点体力值时，你获得2点护甲。",

  ["#mini_mou__kurou-give"] = "苦肉：你可以交给一名其他角色一张牌，你失去1点体力",

  ["$mini_mou__kurou1"] = "刀山火海，死亦无惧！",
  ["$mini_mou__kurou2"] = "我，早有舍弃一切的觉悟了。",
}

kurou:addEffect(fk.EventPhaseStart, {
  anim_type = "control",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(kurou.name) and player.phase == Player.Play
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local to, card = room:askToChooseCardsAndPlayers(player, {
      targets = room:getOtherPlayers(player, false),
      min_num = 1,
      max_num = 1,
      min_card_num = 1,
      max_card_num = 1,
      prompt = "#mini_mou__kurou-give",
      skill_name = kurou.name,
    })
    if #to > 0 and #card > 0 then
      event:setCostData(self, { tos = to, cards = card })
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local to = event:getCostData(self).tos[1]
    local card = event:getCostData(self).cards or {}
    room:moveCardTo(card, Card.PlayerHand, to, fk.ReasonGive, kurou.name, nil, false, player)
    if player.dead then return end
    room:loseHp(player, 1, kurou.name)
  end,
})

kurou:addEffect(fk.HpLost, {
  anim_type = "defensive",
  trigger_times = function (self, event, target, player, data)
    return data.num
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    player.room:changeShield(player, 2)
  end,
})

return kurou
